package cn.iocoder.an.module.mold.dal.mysql.repairjob;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.repairjob.RepairJobDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.repairjob.vo.*;

/**
 * 模具维修任务 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface RepairJobMapper extends BaseMapperX<RepairJobDO> {

    default PageResult<RepairJobDO> selectPage(RepairJobPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RepairJobDO>()
                .eqIfPresent(RepairJobDO::getAssigneerId, reqVO.getAssigneerId())
                .likeIfPresent(RepairJobDO::getCode, reqVO.getCode())
                .eqIfPresent(RepairJobDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(RepairJobDO::getRepairCategoryId, reqVO.getRepairCategoryId())
                .eqIfPresent(RepairJobDO::getFaultId, reqVO.getFaultId())
                .eqIfPresent(RepairJobDO::getApplicantId, reqVO.getApplicantId())
                .eqIfPresent(RepairJobDO::getDepartId, reqVO.getDepartId())
                .betweenIfPresent(RepairJobDO::getApplicationTime, reqVO.getApplicationTime())
                .eqIfPresent(RepairJobDO::getFaultDescription, reqVO.getFaultDescription())
                .eqIfPresent(RepairJobDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RepairJobDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RepairJobDO::getId));
    }

}